home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Str / c / MakeASCIIZ < prev    next >
Text File  |  1995-07-08  |  939b  |  30 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Str.MakeASCIIZ.c
  12.     Author:  Copyright © 1994 Tim Browse
  13.     Version: 1.00 (06 Mar 1994)
  14.     Purpose: Convert a CR-terminated string to be 0-terminated (ASCIIZ).
  15. */
  16.  
  17. #include "DeskLib:Str.h"
  18.  
  19.  
  20. void Str_MakeASCIIZ(char *s, int max_len)
  21. {
  22.   int i = 0;
  23.  
  24.   while ((i < max_len) && (s[i] > 31))
  25.     i++;
  26.  
  27.   if (i < max_len)
  28.     s[i] = '\0'; /* Null terminate it */
  29. }
  30.